
// Copyright (C) 2009-2011 Luca Piccioni
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;

#pragma warning disable 1572, 1573

namespace Derm.OpenGL {

	/// <summary>
	/// Implementation of the OpenGL specification 
	/// </summary>
	public unsafe partial class Glx : ProcLoader
	{

		/// <summary>
		/// Binding for glXBindSwapBarrierNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="group">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		/// <param name="barrier">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		public static bool BindSwapBarrierNV(IntPtr dpy, UInt32 group, UInt32 barrier) {
			bool retvalue;
			if      (Delegates.pglXBindSwapBarrierNV != null)
				retvalue = (Delegates.pglXBindSwapBarrierNV(dpy, group, barrier));
			else
				throw new InvalidOperationException("binding point BindSwapBarrierNV cannot be found");
			LogProc("glXBindSwapBarrierNV({0}, {1}, {2}) = {3}", dpy, group, barrier, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXBindVideoCaptureDeviceNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="video_capture_slot">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		/// <param name="device">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		public static int BindVideoCaptureDeviceNV(IntPtr dpy, UInt32 video_capture_slot, IntPtr device) {
			int retvalue;
			if      (Delegates.pglXBindVideoCaptureDeviceNV != null)
				retvalue = (Delegates.pglXBindVideoCaptureDeviceNV(dpy, video_capture_slot, device));
			else
				throw new InvalidOperationException("binding point BindVideoCaptureDeviceNV cannot be found");
			LogProc("glXBindVideoCaptureDeviceNV({0}, {1}, {2}) = {3}", dpy, video_capture_slot, device, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXBindVideoDeviceNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="video_slot">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		/// <param name="video_device">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		/// <param name="attrib_list">
		/// A <see cref="T:System.Int32*"/>.
		/// </param>
		public static int BindVideoDeviceNV(IntPtr dpy, UInt32 video_slot, UInt32 video_device, ref int[] attrib_list) {
			int retvalue;
			unsafe {
				fixed (int* fp_attrib_list = attrib_list)
				{
					if      (Delegates.pglXBindVideoDeviceNV != null)
						retvalue = (Delegates.pglXBindVideoDeviceNV(dpy, video_slot, video_device, fp_attrib_list));
					else
						throw new InvalidOperationException("binding point BindVideoDeviceNV cannot be found");
				}
			}
			LogProc("glXBindVideoDeviceNV({0}, {1}, {2}, {3}) = {4}", dpy, video_slot, video_device, attrib_list, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXBindVideoImageNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="VideoDevice">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="pbuf">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="iVideoBuffer">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static int BindVideoImageNV(IntPtr dpy, IntPtr VideoDevice, IntPtr pbuf, int iVideoBuffer) {
			int retvalue;
			if      (Delegates.pglXBindVideoImageNV != null)
				retvalue = (Delegates.pglXBindVideoImageNV(dpy, VideoDevice, pbuf, iVideoBuffer));
			else
				throw new InvalidOperationException("binding point BindVideoImageNV cannot be found");
			LogProc("glXBindVideoImageNV({0}, {1}, {2}, {3}) = {4}", dpy, VideoDevice, pbuf, iVideoBuffer, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXChangeDrawableAttributes function.
		/// </summary>
		/// <param name="drawable">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void ChangeDrawableAttributes(Int32 drawable) {
			if      (Delegates.pglXChangeDrawableAttributes != null)
				Delegates.pglXChangeDrawableAttributes(drawable);
			else
				throw new InvalidOperationException("binding point ChangeDrawableAttributes cannot be found");
			LogProc("glXChangeDrawableAttributes({0})", drawable);
		}

		/// <summary>
		/// Binding for glXChooseFBConfig function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="attrib_list">
		/// A <see cref="T:System.Int32*"/>.
		/// </param>
		/// <param name="nelements">
		/// A <see cref="T:System.Int32*"/>.
		/// </param>
		public static IntPtr * ChooseFBConfig(IntPtr dpy, int screen, int[] attrib_list, ref int[] nelements) {
			IntPtr * retvalue;
			unsafe {
				fixed (int* fp_attrib_list = attrib_list)
				fixed (int* fp_nelements = nelements)
				{
					if      (Delegates.pglXChooseFBConfig != null)
						retvalue = (Delegates.pglXChooseFBConfig(dpy, screen, fp_attrib_list, fp_nelements));
					else
						throw new InvalidOperationException("binding point ChooseFBConfig cannot be found");
				}
			}
			LogProc("glXChooseFBConfig({0}, {1}, {2}, {3}) = {4}", dpy, screen, attrib_list, nelements, (retvalue != null) ? (*retvalue).ToInt32() : 0);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXClientInfo function.
		/// </summary>
		public static void ClientInfo() {
			if      (Delegates.pglXClientInfo != null)
				Delegates.pglXClientInfo();
			else
				throw new InvalidOperationException("binding point ClientInfo cannot be found");
			LogProc("glXClientInfo()");
		}

		/// <summary>
		/// Binding for glXCopyContext function.
		/// </summary>
		/// <param name="source">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="dest">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="mask">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void CopyContext(Int32 source, Int32 dest, Int32 mask) {
			if      (Delegates.pglXCopyContext != null)
				Delegates.pglXCopyContext(source, dest, mask);
			else
				throw new InvalidOperationException("binding point CopyContext cannot be found");
			LogProc("glXCopyContext({0}, {1}, {2})", source, dest, mask);
		}

		/// <summary>
		/// Binding for glXCopyImageSubDataNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="srcCtx">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="srcName">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		/// <param name="srcTarget">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="srcLevel">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="srcX">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="srcY">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="srcZ">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="dstCtx">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="dstName">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		/// <param name="dstTarget">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="dstLevel">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="dstX">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="dstY">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="dstZ">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="width">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="height">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="depth">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void CopyImageSubDataNV(IntPtr dpy, IntPtr srcCtx, UInt32 srcName, int srcTarget, int srcLevel, int srcX, int srcY, int srcZ, IntPtr dstCtx, UInt32 dstName, int dstTarget, int dstLevel, int dstX, int dstY, int dstZ, Int32 width, Int32 height, Int32 depth) {
			if      (Delegates.pglXCopyImageSubDataNV != null)
				Delegates.pglXCopyImageSubDataNV(dpy, srcCtx, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstCtx, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth);
			else
				throw new InvalidOperationException("binding point CopyImageSubDataNV cannot be found");
			LogProc("glXCopyImageSubDataNV({0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17})", dpy, srcCtx, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstCtx, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, width, height, depth);
		}

		/// <summary>
		/// Binding for glXCreateContext function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="vis">
		/// A <see cref="T:Glx.XVisualInfo"/>.
		/// </param>
		/// <param name="shareList">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="direct">
		/// A <see cref="T:System.Boolean"/>.
		/// </param>
		public static IntPtr CreateContext(IntPtr dpy, Glx.XVisualInfo vis, IntPtr shareList, bool direct) {
			IntPtr retvalue;
			if      (Delegates.pglXCreateContext != null)
				retvalue = (Delegates.pglXCreateContext(dpy, vis, shareList, direct));
			else
				throw new InvalidOperationException("binding point CreateContext cannot be found");
			LogProc("glXCreateContext({0}, {1}, {2}, {3}) = {4}", dpy, vis, shareList, direct, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXCreateGLXPixmap function.
		/// </summary>
		/// <param name="visual">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="pixmap">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="glxpixmap">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void CreateGLXPixmap(Int32 visual, Int32 pixmap, Int32 glxpixmap) {
			if      (Delegates.pglXCreateGLXPixmap != null)
				Delegates.pglXCreateGLXPixmap(visual, pixmap, glxpixmap);
			else
				throw new InvalidOperationException("binding point CreateGLXPixmap cannot be found");
			LogProc("glXCreateGLXPixmap({0}, {1}, {2})", visual, pixmap, glxpixmap);
		}

		/// <summary>
		/// Binding for glXCreateNewContext function.
		/// </summary>
		/// <param name="config">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="render_type">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="share_list">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="direct">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void CreateNewContext(Int32 config, Int32 render_type, Int32 share_list, Int32 direct) {
			if      (Delegates.pglXCreateNewContext != null)
				Delegates.pglXCreateNewContext(config, render_type, share_list, direct);
			else
				throw new InvalidOperationException("binding point CreateNewContext cannot be found");
			LogProc("glXCreateNewContext({0}, {1}, {2}, {3})", config, render_type, share_list, direct);
		}

		/// <summary>
		/// Binding for glXCreatePbuffer function.
		/// </summary>
		/// <param name="config">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="pbuffer">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void CreatePbuffer(Int32 config, Int32 pbuffer) {
			if      (Delegates.pglXCreatePbuffer != null)
				Delegates.pglXCreatePbuffer(config, pbuffer);
			else
				throw new InvalidOperationException("binding point CreatePbuffer cannot be found");
			LogProc("glXCreatePbuffer({0}, {1})", config, pbuffer);
		}

		/// <summary>
		/// Binding for glXCreatePixmap function.
		/// </summary>
		/// <param name="config">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="pixmap">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="glxpixmap">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void CreatePixmap(Int32 config, Int32 pixmap, Int32 glxpixmap) {
			if      (Delegates.pglXCreatePixmap != null)
				Delegates.pglXCreatePixmap(config, pixmap, glxpixmap);
			else
				throw new InvalidOperationException("binding point CreatePixmap cannot be found");
			LogProc("glXCreatePixmap({0}, {1}, {2})", config, pixmap, glxpixmap);
		}

		/// <summary>
		/// Binding for glXCreateWindow function.
		/// </summary>
		/// <param name="config">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="window">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="glxwindow">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void CreateWindow(Int32 config, Int32 window, Int32 glxwindow) {
			if      (Delegates.pglXCreateWindow != null)
				Delegates.pglXCreateWindow(config, window, glxwindow);
			else
				throw new InvalidOperationException("binding point CreateWindow cannot be found");
			LogProc("glXCreateWindow({0}, {1}, {2})", config, window, glxwindow);
		}

		/// <summary>
		/// Binding for glXDestroyContext function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="context">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void DestroyContext(IntPtr dpy, Int32 context) {
			if      (Delegates.pglXDestroyContext != null)
				Delegates.pglXDestroyContext(dpy, context);
			else
				throw new InvalidOperationException("binding point DestroyContext cannot be found");
			LogProc("glXDestroyContext({0}, {1})", dpy, context);
		}

		/// <summary>
		/// Binding for glXDestroyGLXPixmap function.
		/// </summary>
		/// <param name="pixmap">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void DestroyGLXPixmap(Int32 pixmap) {
			if      (Delegates.pglXDestroyGLXPixmap != null)
				Delegates.pglXDestroyGLXPixmap(pixmap);
			else
				throw new InvalidOperationException("binding point DestroyGLXPixmap cannot be found");
			LogProc("glXDestroyGLXPixmap({0})", pixmap);
		}

		/// <summary>
		/// Binding for glXDestroyPbuffer function.
		/// </summary>
		/// <param name="pbuffer">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void DestroyPbuffer(Int32 pbuffer) {
			if      (Delegates.pglXDestroyPbuffer != null)
				Delegates.pglXDestroyPbuffer(pbuffer);
			else
				throw new InvalidOperationException("binding point DestroyPbuffer cannot be found");
			LogProc("glXDestroyPbuffer({0})", pbuffer);
		}

		/// <summary>
		/// Binding for glXDestroyPixmap function.
		/// </summary>
		/// <param name="glxpixmap">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void DestroyPixmap(Int32 glxpixmap) {
			if      (Delegates.pglXDestroyPixmap != null)
				Delegates.pglXDestroyPixmap(glxpixmap);
			else
				throw new InvalidOperationException("binding point DestroyPixmap cannot be found");
			LogProc("glXDestroyPixmap({0})", glxpixmap);
		}

		/// <summary>
		/// Binding for glXDestroyWindow function.
		/// </summary>
		/// <param name="glxwindow">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void DestroyWindow(Int32 glxwindow) {
			if      (Delegates.pglXDestroyWindow != null)
				Delegates.pglXDestroyWindow(glxwindow);
			else
				throw new InvalidOperationException("binding point DestroyWindow cannot be found");
			LogProc("glXDestroyWindow({0})", glxwindow);
		}

		/// <summary>
		/// Binding for glXEnumerateVideoCaptureDevicesNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="nelements">
		/// A <see cref="T:System.Int32*"/>.
		/// </param>
		public static IntPtr EnumerateVideoCaptureDevicesNV(IntPtr dpy, int screen, ref int[] nelements) {
			IntPtr retvalue;
			unsafe {
				fixed (int* fp_nelements = nelements)
				{
					if      (Delegates.pglXEnumerateVideoCaptureDevicesNV != null)
						retvalue = (Delegates.pglXEnumerateVideoCaptureDevicesNV(dpy, screen, fp_nelements));
					else
						throw new InvalidOperationException("binding point EnumerateVideoCaptureDevicesNV cannot be found");
				}
			}
			LogProc("glXEnumerateVideoCaptureDevicesNV({0}, {1}, {2}) = {3}", dpy, screen, nelements, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXEnumerateVideoDevicesNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="nelements">
		/// A <see cref="T:System.Int32*"/>.
		/// </param>
		public static IntPtr EnumerateVideoDevicesNV(IntPtr dpy, int screen, ref int[] nelements) {
			IntPtr retvalue;
			unsafe {
				fixed (int* fp_nelements = nelements)
				{
					if      (Delegates.pglXEnumerateVideoDevicesNV != null)
						retvalue = (Delegates.pglXEnumerateVideoDevicesNV(dpy, screen, fp_nelements));
					else
						throw new InvalidOperationException("binding point EnumerateVideoDevicesNV cannot be found");
				}
			}
			LogProc("glXEnumerateVideoDevicesNV({0}, {1}, {2}) = {3}", dpy, screen, nelements, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetCurrentDisplay function.
		/// </summary>
		public static IntPtr GetCurrentDisplay() {
			IntPtr retvalue;
			if      (Delegates.pglXGetCurrentDisplay != null)
				retvalue = (Delegates.pglXGetCurrentDisplay());
			else
				throw new InvalidOperationException("binding point GetCurrentDisplay cannot be found");
			LogProc("glXGetCurrentDisplay()");
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetCurrentReadDrawable function.
		/// </summary>
		public static IntPtr GetCurrentReadDrawable() {
			IntPtr retvalue;
			if      (Delegates.pglXGetCurrentReadDrawable != null)
				retvalue = (Delegates.pglXGetCurrentReadDrawable());
			else
				throw new InvalidOperationException("binding point GetCurrentReadDrawable cannot be found");
			LogProc("glXGetCurrentReadDrawable()");
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetDrawableAttributes function.
		/// </summary>
		/// <param name="drawable">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void GetDrawableAttributes(Int32 drawable) {
			if      (Delegates.pglXGetDrawableAttributes != null)
				Delegates.pglXGetDrawableAttributes(drawable);
			else
				throw new InvalidOperationException("binding point GetDrawableAttributes cannot be found");
			LogProc("glXGetDrawableAttributes({0})", drawable);
		}

		/// <summary>
		/// Binding for glXGetFBConfigAttrib function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="config">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="attribute">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="value">
		/// A <see cref="T:System.Int32"/>.
		/// This parameter holds data returned from function.
		/// </param>
		public static int GetFBConfigAttrib(IntPtr dpy, IntPtr config, int attribute, [Out] out int value) {
			int retvalue;
			unsafe {
				fixed (int* fp_value = &value)
				{
					if      (Delegates.pglXGetFBConfigAttrib != null)
						retvalue = (Delegates.pglXGetFBConfigAttrib(dpy, config, attribute, fp_value));
					else
						throw new InvalidOperationException("binding point GetFBConfigAttrib cannot be found");
				}
			}
			LogProc("glXGetFBConfigAttrib({0}, {1}, {2}, {3}) = {4}", dpy, config, attribute, value, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetFBConfigs function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="nelements">
		/// A <see cref="T:System.Int32"/>.
		/// This parameter holds data returned from function.
		/// </param>
		public static IntPtr * GetFBConfigs(IntPtr dpy, Int32 screen, [Out] out Int32 nelements) {
			IntPtr * retvalue;
			unsafe {
				fixed (Int32* fp_nelements = &nelements)
				{
					if      (Delegates.pglXGetFBConfigs != null)
						retvalue = (Delegates.pglXGetFBConfigs(dpy, screen, fp_nelements));
					else
						throw new InvalidOperationException("binding point GetFBConfigs cannot be found");
				}
			}
			LogProc("glXGetFBConfigs({0}, {1}, {2}) = {3}", dpy, screen, nelements, (retvalue != null) ? (*retvalue).ToInt32() : 0);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetProcAddress function.
		/// </summary>
		/// <param name="procName">
		/// A <see cref="T:System.Byte*"/>.
		/// </param>
		public static IntPtr GetProcAddress(ref byte[] procName) {
			IntPtr retvalue;
			unsafe {
				fixed (byte* fp_procName = procName)
				{
					if      (Delegates.pglXGetProcAddress != null)
						retvalue = (Delegates.pglXGetProcAddress(fp_procName));
					else
						throw new InvalidOperationException("binding point GetProcAddress cannot be found");
				}
			}
			LogProc("glXGetProcAddress({0}) = {1}", procName, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetSelectedEvent function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="draw">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="event_mask">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		public static void GetSelectedEvent(IntPtr dpy, IntPtr draw, ref UInt32[] event_mask) {
			unsafe {
				fixed (UInt32* fp_event_mask = event_mask)
				{
					if      (Delegates.pglXGetSelectedEvent != null)
						Delegates.pglXGetSelectedEvent(dpy, draw, fp_event_mask);
					else
						throw new InvalidOperationException("binding point GetSelectedEvent cannot be found");
				}
			}
			LogProc("glXGetSelectedEvent({0}, {1}, {2})", dpy, draw, event_mask);
		}

		/// <summary>
		/// Binding for glXGetVideoDeviceNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="numVideoDevices">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="pVideoDevice">
		/// A <see cref="T:System.IntPtr*"/>.
		/// This parameter holds data returned from function.
		/// </param>
		public static int GetVideoDeviceNV(IntPtr dpy, int screen, int numVideoDevices, [Out] IntPtr[] pVideoDevice) {
			int retvalue;
			unsafe {
				fixed (IntPtr* fp_pVideoDevice = pVideoDevice)
				{
					if      (Delegates.pglXGetVideoDeviceNV != null)
						retvalue = (Delegates.pglXGetVideoDeviceNV(dpy, screen, numVideoDevices, fp_pVideoDevice));
					else
						throw new InvalidOperationException("binding point GetVideoDeviceNV cannot be found");
				}
			}
			LogProc("glXGetVideoDeviceNV({0}, {1}, {2}, {3}) = {4}", dpy, screen, numVideoDevices, pVideoDevice, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetVideoInfoNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="VideoDevice">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="pulCounterOutputPbuffer">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		/// <param name="pulCounterOutputVideo">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		public static int GetVideoInfoNV(IntPtr dpy, int screen, IntPtr VideoDevice, ref UInt32[] pulCounterOutputPbuffer, ref UInt32[] pulCounterOutputVideo) {
			int retvalue;
			unsafe {
				fixed (UInt32* fp_pulCounterOutputPbuffer = pulCounterOutputPbuffer)
				fixed (UInt32* fp_pulCounterOutputVideo = pulCounterOutputVideo)
				{
					if      (Delegates.pglXGetVideoInfoNV != null)
						retvalue = (Delegates.pglXGetVideoInfoNV(dpy, screen, VideoDevice, fp_pulCounterOutputPbuffer, fp_pulCounterOutputVideo));
					else
						throw new InvalidOperationException("binding point GetVideoInfoNV cannot be found");
				}
			}
			LogProc("glXGetVideoInfoNV({0}, {1}, {2}, {3}, {4}) = {5}", dpy, screen, VideoDevice, pulCounterOutputPbuffer, pulCounterOutputVideo, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXGetVisualConfigs function.
		/// </summary>
		public static void GetVisualConfigs() {
			if      (Delegates.pglXGetVisualConfigs != null)
				Delegates.pglXGetVisualConfigs();
			else
				throw new InvalidOperationException("binding point GetVisualConfigs cannot be found");
			LogProc("glXGetVisualConfigs()");
		}

		/// <summary>
		/// Binding for glXGetVisualFromFBConfig function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="config">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		public static IntPtr GetVisualFromFBConfig(IntPtr dpy, IntPtr config) {
			IntPtr retvalue;
			if      (Delegates.pglXGetVisualFromFBConfig != null)
				retvalue = (Delegates.pglXGetVisualFromFBConfig(dpy, config));
			else
				throw new InvalidOperationException("binding point GetVisualFromFBConfig cannot be found");
			LogProc("glXGetVisualFromFBConfig({0}, {1}) = {2}", dpy, config, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXIsDirect function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="context">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void IsDirect(Int32 dpy, Int32 context) {
			if      (Delegates.pglXIsDirect != null)
				Delegates.pglXIsDirect(dpy, context);
			else
				throw new InvalidOperationException("binding point IsDirect cannot be found");
			LogProc("glXIsDirect({0}, {1})", dpy, context);
		}

		/// <summary>
		/// Binding for glXJoinSwapGroupNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="drawable">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="group">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		public static bool JoinSwapGroupNV(IntPtr dpy, IntPtr drawable, UInt32 group) {
			bool retvalue;
			if      (Delegates.pglXJoinSwapGroupNV != null)
				retvalue = (Delegates.pglXJoinSwapGroupNV(dpy, drawable, group));
			else
				throw new InvalidOperationException("binding point JoinSwapGroupNV cannot be found");
			LogProc("glXJoinSwapGroupNV({0}, {1}, {2}) = {3}", dpy, drawable, group, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXLockVideoCaptureDeviceNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="device">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		public static void LockVideoCaptureDeviceNV(IntPtr dpy, IntPtr device) {
			if      (Delegates.pglXLockVideoCaptureDeviceNV != null)
				Delegates.pglXLockVideoCaptureDeviceNV(dpy, device);
			else
				throw new InvalidOperationException("binding point LockVideoCaptureDeviceNV cannot be found");
			LogProc("glXLockVideoCaptureDeviceNV({0}, {1})", dpy, device);
		}

		/// <summary>
		/// Binding for glXMakeContextCurrent function.
		/// </summary>
		/// <param name="drawable">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="readdrawable">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="context">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void MakeContextCurrent(Int32 drawable, Int32 readdrawable, Int32 context) {
			if      (Delegates.pglXMakeContextCurrent != null)
				Delegates.pglXMakeContextCurrent(drawable, readdrawable, context);
			else
				throw new InvalidOperationException("binding point MakeContextCurrent cannot be found");
			LogProc("glXMakeContextCurrent({0}, {1}, {2})", drawable, readdrawable, context);
		}

		/// <summary>
		/// Binding for glXMakeCurrent function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="drawable">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="context">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static bool MakeCurrent(IntPtr dpy, Int32 drawable, Int32 context) {
			bool retvalue;
			if      (Delegates.pglXMakeCurrent != null)
				retvalue = (Delegates.pglXMakeCurrent(dpy, drawable, context));
			else
				throw new InvalidOperationException("binding point MakeCurrent cannot be found");
			LogProc("glXMakeCurrent({0}, {1}, {2}) = {3}", dpy, drawable, context, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXQueryContext function.
		/// </summary>
		public static void QueryContext() {
			if      (Delegates.pglXQueryContext != null)
				Delegates.pglXQueryContext();
			else
				throw new InvalidOperationException("binding point QueryContext cannot be found");
			LogProc("glXQueryContext()");
		}

		/// <summary>
		/// Binding for glXQueryDrawable function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="draw">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="attribute">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="value">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		public static void QueryDrawable(IntPtr dpy, IntPtr draw, int attribute, ref UInt32[] value) {
			unsafe {
				fixed (UInt32* fp_value = value)
				{
					if      (Delegates.pglXQueryDrawable != null)
						Delegates.pglXQueryDrawable(dpy, draw, attribute, fp_value);
					else
						throw new InvalidOperationException("binding point QueryDrawable cannot be found");
				}
			}
			LogProc("glXQueryDrawable({0}, {1}, {2}, {3})", dpy, draw, attribute, value);
		}

		/// <summary>
		/// Binding for glXQueryExtensionsString function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static string QueryExtensionsString(IntPtr dpy, Int32 screen) {
			string retvalue;
			if      (Delegates.pglXQueryExtensionsString != null)
				retvalue = (Marshal.PtrToStringAnsi(Delegates.pglXQueryExtensionsString(dpy, screen)));
			else
				throw new InvalidOperationException("binding point QueryExtensionsString cannot be found");
			LogProc("glXQueryExtensionsString({0}, {1}) = {2}", dpy, screen, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXQueryFrameCountNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="count">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		public static bool QueryFrameCountNV(IntPtr dpy, int screen, ref UInt32[] count) {
			bool retvalue;
			unsafe {
				fixed (UInt32* fp_count = count)
				{
					if      (Delegates.pglXQueryFrameCountNV != null)
						retvalue = (Delegates.pglXQueryFrameCountNV(dpy, screen, fp_count));
					else
						throw new InvalidOperationException("binding point QueryFrameCountNV cannot be found");
				}
			}
			LogProc("glXQueryFrameCountNV({0}, {1}, {2}) = {3}", dpy, screen, count, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXQueryMaxSwapGroupsNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="maxGroups">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		/// <param name="maxBarriers">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		public static bool QueryMaxSwapGroupsNV(IntPtr dpy, int screen, ref UInt32[] maxGroups, ref UInt32[] maxBarriers) {
			bool retvalue;
			unsafe {
				fixed (UInt32* fp_maxGroups = maxGroups)
				fixed (UInt32* fp_maxBarriers = maxBarriers)
				{
					if      (Delegates.pglXQueryMaxSwapGroupsNV != null)
						retvalue = (Delegates.pglXQueryMaxSwapGroupsNV(dpy, screen, fp_maxGroups, fp_maxBarriers));
					else
						throw new InvalidOperationException("binding point QueryMaxSwapGroupsNV cannot be found");
				}
			}
			LogProc("glXQueryMaxSwapGroupsNV({0}, {1}, {2}, {3}) = {4}", dpy, screen, maxGroups, maxBarriers, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXQueryServerString function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="name">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static string QueryServerString(IntPtr dpy, Int32 screen, Int32 name) {
			string retvalue;
			if      (Delegates.pglXQueryServerString != null)
				retvalue = (Marshal.PtrToStringAnsi(Delegates.pglXQueryServerString(dpy, screen, name)));
			else
				throw new InvalidOperationException("binding point QueryServerString cannot be found");
			LogProc("glXQueryServerString({0}, {1}, {2}) = {3}", dpy, screen, name, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXQuerySwapGroupNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="drawable">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="group">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		/// <param name="barrier">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		public static bool QuerySwapGroupNV(IntPtr dpy, IntPtr drawable, ref UInt32[] group, ref UInt32[] barrier) {
			bool retvalue;
			unsafe {
				fixed (UInt32* fp_group = group)
				fixed (UInt32* fp_barrier = barrier)
				{
					if      (Delegates.pglXQuerySwapGroupNV != null)
						retvalue = (Delegates.pglXQuerySwapGroupNV(dpy, drawable, fp_group, fp_barrier));
					else
						throw new InvalidOperationException("binding point QuerySwapGroupNV cannot be found");
				}
			}
			LogProc("glXQuerySwapGroupNV({0}, {1}, {2}, {3}) = {4}", dpy, drawable, group, barrier, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXQueryVersion function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="major">
		/// A <see cref="T:System.Int32*"/>.
		/// This parameter holds data returned from function.
		/// </param>
		/// <param name="minor">
		/// A <see cref="T:System.Int32*"/>.
		/// This parameter holds data returned from function.
		/// </param>
		public static void QueryVersion(IntPtr dpy, [Out] Int32[] major, [Out] Int32[] minor) {
			unsafe {
				fixed (Int32* fp_major = major)
				fixed (Int32* fp_minor = minor)
				{
					if      (Delegates.pglXQueryVersion != null)
						Delegates.pglXQueryVersion(dpy, fp_major, fp_minor);
					else
						throw new InvalidOperationException("binding point QueryVersion cannot be found");
				}
			}
			LogProc("glXQueryVersion({0}, {1}, {2})", dpy, major, minor);
		}

		/// <summary>
		/// Binding for glXQueryVersion function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="major">
		/// A <see cref="T:System.Int32*"/>.
		/// This parameter holds data returned from function.
		/// </param>
		/// <param name="minor">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void QueryVersion(IntPtr dpy, [Out] Int32[] major, Int32* minor) {
			unsafe {
				fixed (Int32* fp_major = major)
				{
					if      (Delegates.pglXQueryVersion != null)
						Delegates.pglXQueryVersion(dpy, fp_major, minor);
					else
						throw new InvalidOperationException("binding point QueryVersion cannot be found");
				}
			}
			LogProc("glXQueryVersion({0}, {1}, {2})", dpy, major, "minor");
		}
		

		/// <summary>
		/// Binding for glXQueryVideoCaptureDeviceNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="device">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="attribute">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="value">
		/// A <see cref="T:System.Int32*"/>.
		/// This parameter holds data returned from function.
		/// </param>
		public static int QueryVideoCaptureDeviceNV(IntPtr dpy, IntPtr device, int attribute, [Out] int[] value) {
			int retvalue;
			unsafe {
				fixed (int* fp_value = value)
				{
					if      (Delegates.pglXQueryVideoCaptureDeviceNV != null)
						retvalue = (Delegates.pglXQueryVideoCaptureDeviceNV(dpy, device, attribute, fp_value));
					else
						throw new InvalidOperationException("binding point QueryVideoCaptureDeviceNV cannot be found");
				}
			}
			LogProc("glXQueryVideoCaptureDeviceNV({0}, {1}, {2}, {3}) = {4}", dpy, device, attribute, value, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXReleaseVideoCaptureDeviceNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="device">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		public static void ReleaseVideoCaptureDeviceNV(IntPtr dpy, IntPtr device) {
			if      (Delegates.pglXReleaseVideoCaptureDeviceNV != null)
				Delegates.pglXReleaseVideoCaptureDeviceNV(dpy, device);
			else
				throw new InvalidOperationException("binding point ReleaseVideoCaptureDeviceNV cannot be found");
			LogProc("glXReleaseVideoCaptureDeviceNV({0}, {1})", dpy, device);
		}

		/// <summary>
		/// Binding for glXReleaseVideoDeviceNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="VideoDevice">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		public static int ReleaseVideoDeviceNV(IntPtr dpy, int screen, IntPtr VideoDevice) {
			int retvalue;
			if      (Delegates.pglXReleaseVideoDeviceNV != null)
				retvalue = (Delegates.pglXReleaseVideoDeviceNV(dpy, screen, VideoDevice));
			else
				throw new InvalidOperationException("binding point ReleaseVideoDeviceNV cannot be found");
			LogProc("glXReleaseVideoDeviceNV({0}, {1}, {2}) = {3}", dpy, screen, VideoDevice, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXReleaseVideoImageNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="pbuf">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		public static int ReleaseVideoImageNV(IntPtr dpy, IntPtr pbuf) {
			int retvalue;
			if      (Delegates.pglXReleaseVideoImageNV != null)
				retvalue = (Delegates.pglXReleaseVideoImageNV(dpy, pbuf));
			else
				throw new InvalidOperationException("binding point ReleaseVideoImageNV cannot be found");
			LogProc("glXReleaseVideoImageNV({0}, {1}) = {2}", dpy, pbuf, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXRender function.
		/// </summary>
		public static void Render() {
			if      (Delegates.pglXRender != null)
				Delegates.pglXRender();
			else
				throw new InvalidOperationException("binding point Render cannot be found");
			LogProc("glXRender()");
		}

		/// <summary>
		/// Binding for glXRenderLarge function.
		/// </summary>
		public static void RenderLarge() {
			if      (Delegates.pglXRenderLarge != null)
				Delegates.pglXRenderLarge();
			else
				throw new InvalidOperationException("binding point RenderLarge cannot be found");
			LogProc("glXRenderLarge()");
		}

		/// <summary>
		/// Binding for glXResetFrameCountNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="screen">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static bool ResetFrameCountNV(IntPtr dpy, int screen) {
			bool retvalue;
			if      (Delegates.pglXResetFrameCountNV != null)
				retvalue = (Delegates.pglXResetFrameCountNV(dpy, screen));
			else
				throw new InvalidOperationException("binding point ResetFrameCountNV cannot be found");
			LogProc("glXResetFrameCountNV({0}, {1}) = {2}", dpy, screen, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXSelectEvent function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="draw">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="event_mask">
		/// A <see cref="T:System.UInt32"/>.
		/// </param>
		public static void SelectEvent(IntPtr dpy, IntPtr draw, UInt32 event_mask) {
			if      (Delegates.pglXSelectEvent != null)
				Delegates.pglXSelectEvent(dpy, draw, event_mask);
			else
				throw new InvalidOperationException("binding point SelectEvent cannot be found");
			LogProc("glXSelectEvent({0}, {1}, {2})", dpy, draw, event_mask);
		}

		/// <summary>
		/// Binding for glXSendPbufferToVideoNV function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="pbuf">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="iBufferType">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="pulCounterPbuffer">
		/// A <see cref="T:System.UInt32*"/>.
		/// </param>
		/// <param name="bBlock">
		/// A <see cref="T:System.Boolean"/>.
		/// </param>
		public static int SendPbufferToVideoNV(IntPtr dpy, IntPtr pbuf, int iBufferType, ref UInt32[] pulCounterPbuffer, bool bBlock) {
			int retvalue;
			unsafe {
				fixed (UInt32* fp_pulCounterPbuffer = pulCounterPbuffer)
				{
					if      (Delegates.pglXSendPbufferToVideoNV != null)
						retvalue = (Delegates.pglXSendPbufferToVideoNV(dpy, pbuf, iBufferType, fp_pulCounterPbuffer, bBlock));
					else
						throw new InvalidOperationException("binding point SendPbufferToVideoNV cannot be found");
				}
			}
			LogProc("glXSendPbufferToVideoNV({0}, {1}, {2}, {3}, {4}) = {5}", dpy, pbuf, iBufferType, pulCounterPbuffer, bBlock, retvalue);
			return (retvalue);
		}

		/// <summary>
		/// Binding for glXSwapBuffers function.
		/// </summary>
		/// <param name="dpy">
		/// A <see cref="T:System.IntPtr"/>.
		/// </param>
		/// <param name="drawable">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void SwapBuffers(IntPtr dpy, Int32 drawable) {
			if      (Delegates.pglXSwapBuffers != null)
				Delegates.pglXSwapBuffers(dpy, drawable);
			else
				throw new InvalidOperationException("binding point SwapBuffers cannot be found");
			LogProc("glXSwapBuffers({0}, {1})", dpy, drawable);
		}

		/// <summary>
		/// Binding for glXUseXFont function.
		/// </summary>
		/// <param name="font">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="first">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="count">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		/// <param name="list_base">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void UseXFont(Int32 font, Int32 first, Int32 count, Int32 list_base) {
			if      (Delegates.pglXUseXFont != null)
				Delegates.pglXUseXFont(font, first, count, list_base);
			else
				throw new InvalidOperationException("binding point UseXFont cannot be found");
			LogProc("glXUseXFont({0}, {1}, {2}, {3})", font, first, count, list_base);
		}

		/// <summary>
		/// Binding for glXVendorPrivate function.
		/// </summary>
		public static void VendorPrivate() {
			if      (Delegates.pglXVendorPrivate != null)
				Delegates.pglXVendorPrivate();
			else
				throw new InvalidOperationException("binding point VendorPrivate cannot be found");
			LogProc("glXVendorPrivate()");
		}

		/// <summary>
		/// Binding for glXVendorPrivateWithReply function.
		/// </summary>
		public static void VendorPrivateWithReply() {
			if      (Delegates.pglXVendorPrivateWithReply != null)
				Delegates.pglXVendorPrivateWithReply();
			else
				throw new InvalidOperationException("binding point VendorPrivateWithReply cannot be found");
			LogProc("glXVendorPrivateWithReply()");
		}

		/// <summary>
		/// Binding for glXWaitGL function.
		/// </summary>
		/// <param name="context">
		/// A <see cref="T:System.Int32"/>.
		/// </param>
		public static void WaitGL(Int32 context) {
			if      (Delegates.pglXWaitGL != null)
				Delegates.pglXWaitGL(context);
			else
				throw new InvalidOperationException("binding point WaitGL cannot be found");
			LogProc("glXWaitGL({0})", context);
		}

		/// <summary>
		/// Binding for glXWaitX function.
		/// </summary>
		public static void WaitX() {
			if      (Delegates.pglXWaitX != null)
				Delegates.pglXWaitX();
			else
				throw new InvalidOperationException("binding point WaitX cannot be found");
			LogProc("glXWaitX()");
		}

		internal static partial class Delegates
		{
			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate bool glXBindSwapBarrierNV(IntPtr dpy, UInt32 group, UInt32 barrier);
			internal static glXBindSwapBarrierNV pglXBindSwapBarrierNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate int glXBindVideoCaptureDeviceNV(IntPtr dpy, UInt32 video_capture_slot, IntPtr device);
			internal static glXBindVideoCaptureDeviceNV pglXBindVideoCaptureDeviceNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate int glXBindVideoDeviceNV(IntPtr dpy, UInt32 video_slot, UInt32 video_device, int* attrib_list);
			internal static glXBindVideoDeviceNV pglXBindVideoDeviceNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate int glXBindVideoImageNV(IntPtr dpy, IntPtr VideoDevice, IntPtr pbuf, int iVideoBuffer);
			internal static glXBindVideoImageNV pglXBindVideoImageNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXChangeDrawableAttributes(Int32 drawable);
			internal static glXChangeDrawableAttributes pglXChangeDrawableAttributes = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate IntPtr * glXChooseFBConfig(IntPtr dpy, int screen, int* attrib_list, int* nelements);
			internal static glXChooseFBConfig pglXChooseFBConfig = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXClientInfo();
			internal static glXClientInfo pglXClientInfo = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXCopyContext(Int32 source, Int32 dest, Int32 mask);
			internal static glXCopyContext pglXCopyContext = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXCopyImageSubDataNV(IntPtr dpy, IntPtr srcCtx, UInt32 srcName, int srcTarget, int srcLevel, int srcX, int srcY, int srcZ, IntPtr dstCtx, UInt32 dstName, int dstTarget, int dstLevel, int dstX, int dstY, int dstZ, Int32 width, Int32 height, Int32 depth);
			internal static glXCopyImageSubDataNV pglXCopyImageSubDataNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate IntPtr glXCreateContext(IntPtr dpy, Glx.XVisualInfo vis, IntPtr shareList, bool direct);
			internal static glXCreateContext pglXCreateContext = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXCreateGLXPixmap(Int32 visual, Int32 pixmap, Int32 glxpixmap);
			internal static glXCreateGLXPixmap pglXCreateGLXPixmap = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXCreateNewContext(Int32 config, Int32 render_type, Int32 share_list, Int32 direct);
			internal static glXCreateNewContext pglXCreateNewContext = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXCreatePbuffer(Int32 config, Int32 pbuffer);
			internal static glXCreatePbuffer pglXCreatePbuffer = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXCreatePixmap(Int32 config, Int32 pixmap, Int32 glxpixmap);
			internal static glXCreatePixmap pglXCreatePixmap = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXCreateWindow(Int32 config, Int32 window, Int32 glxwindow);
			internal static glXCreateWindow pglXCreateWindow = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXDestroyContext(IntPtr dpy, Int32 context);
			internal static glXDestroyContext pglXDestroyContext = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXDestroyGLXPixmap(Int32 pixmap);
			internal static glXDestroyGLXPixmap pglXDestroyGLXPixmap = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXDestroyPbuffer(Int32 pbuffer);
			internal static glXDestroyPbuffer pglXDestroyPbuffer = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXDestroyPixmap(Int32 glxpixmap);
			internal static glXDestroyPixmap pglXDestroyPixmap = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXDestroyWindow(Int32 glxwindow);
			internal static glXDestroyWindow pglXDestroyWindow = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate IntPtr glXEnumerateVideoCaptureDevicesNV(IntPtr dpy, int screen, int* nelements);
			internal static glXEnumerateVideoCaptureDevicesNV pglXEnumerateVideoCaptureDevicesNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate IntPtr glXEnumerateVideoDevicesNV(IntPtr dpy, int screen, int* nelements);
			internal static glXEnumerateVideoDevicesNV pglXEnumerateVideoDevicesNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate IntPtr glXGetCurrentDisplay();
			internal static glXGetCurrentDisplay pglXGetCurrentDisplay = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate IntPtr glXGetCurrentReadDrawable();
			internal static glXGetCurrentReadDrawable pglXGetCurrentReadDrawable = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXGetDrawableAttributes(Int32 drawable);
			internal static glXGetDrawableAttributes pglXGetDrawableAttributes = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate int glXGetFBConfigAttrib(IntPtr dpy, IntPtr config, int attribute, [Out] int* value);
			internal static glXGetFBConfigAttrib pglXGetFBConfigAttrib = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate IntPtr * glXGetFBConfigs(IntPtr dpy, Int32 screen, [Out] Int32* nelements);
			internal static glXGetFBConfigs pglXGetFBConfigs = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate IntPtr glXGetProcAddress(byte* procName);
			internal static glXGetProcAddress pglXGetProcAddress = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate void glXGetSelectedEvent(IntPtr dpy, IntPtr draw, UInt32* event_mask);
			internal static glXGetSelectedEvent pglXGetSelectedEvent = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate int glXGetVideoDeviceNV(IntPtr dpy, int screen, int numVideoDevices, [Out] IntPtr* pVideoDevice);
			internal static glXGetVideoDeviceNV pglXGetVideoDeviceNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate int glXGetVideoInfoNV(IntPtr dpy, int screen, IntPtr VideoDevice, UInt32* pulCounterOutputPbuffer, UInt32* pulCounterOutputVideo);
			internal static glXGetVideoInfoNV pglXGetVideoInfoNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXGetVisualConfigs();
			internal static glXGetVisualConfigs pglXGetVisualConfigs = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate IntPtr glXGetVisualFromFBConfig(IntPtr dpy, IntPtr config);
			internal static glXGetVisualFromFBConfig pglXGetVisualFromFBConfig = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXIsDirect(Int32 dpy, Int32 context);
			internal static glXIsDirect pglXIsDirect = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate bool glXJoinSwapGroupNV(IntPtr dpy, IntPtr drawable, UInt32 group);
			internal static glXJoinSwapGroupNV pglXJoinSwapGroupNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXLockVideoCaptureDeviceNV(IntPtr dpy, IntPtr device);
			internal static glXLockVideoCaptureDeviceNV pglXLockVideoCaptureDeviceNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXMakeContextCurrent(Int32 drawable, Int32 readdrawable, Int32 context);
			internal static glXMakeContextCurrent pglXMakeContextCurrent = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate bool glXMakeCurrent(IntPtr dpy, Int32 drawable, Int32 context);
			internal static glXMakeCurrent pglXMakeCurrent = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXQueryContext();
			internal static glXQueryContext pglXQueryContext = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate void glXQueryDrawable(IntPtr dpy, IntPtr draw, int attribute, UInt32* value);
			internal static glXQueryDrawable pglXQueryDrawable = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate IntPtr glXQueryExtensionsString(IntPtr dpy, Int32 screen);
			internal static glXQueryExtensionsString pglXQueryExtensionsString = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate bool glXQueryFrameCountNV(IntPtr dpy, int screen, UInt32* count);
			internal static glXQueryFrameCountNV pglXQueryFrameCountNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate bool glXQueryMaxSwapGroupsNV(IntPtr dpy, int screen, UInt32* maxGroups, UInt32* maxBarriers);
			internal static glXQueryMaxSwapGroupsNV pglXQueryMaxSwapGroupsNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate IntPtr glXQueryServerString(IntPtr dpy, Int32 screen, Int32 name);
			internal static glXQueryServerString pglXQueryServerString = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate bool glXQuerySwapGroupNV(IntPtr dpy, IntPtr drawable, UInt32* group, UInt32* barrier);
			internal static glXQuerySwapGroupNV pglXQuerySwapGroupNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate void glXQueryVersion(IntPtr dpy, [Out] Int32* major, [Out] Int32* minor);
			internal static glXQueryVersion pglXQueryVersion = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate int glXQueryVideoCaptureDeviceNV(IntPtr dpy, IntPtr device, int attribute, [Out] int* value);
			internal static glXQueryVideoCaptureDeviceNV pglXQueryVideoCaptureDeviceNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXReleaseVideoCaptureDeviceNV(IntPtr dpy, IntPtr device);
			internal static glXReleaseVideoCaptureDeviceNV pglXReleaseVideoCaptureDeviceNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate int glXReleaseVideoDeviceNV(IntPtr dpy, int screen, IntPtr VideoDevice);
			internal static glXReleaseVideoDeviceNV pglXReleaseVideoDeviceNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate int glXReleaseVideoImageNV(IntPtr dpy, IntPtr pbuf);
			internal static glXReleaseVideoImageNV pglXReleaseVideoImageNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXRender();
			internal static glXRender pglXRender = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXRenderLarge();
			internal static glXRenderLarge pglXRenderLarge = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate bool glXResetFrameCountNV(IntPtr dpy, int screen);
			internal static glXResetFrameCountNV pglXResetFrameCountNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXSelectEvent(IntPtr dpy, IntPtr draw, UInt32 event_mask);
			internal static glXSelectEvent pglXSelectEvent = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal unsafe delegate int glXSendPbufferToVideoNV(IntPtr dpy, IntPtr pbuf, int iBufferType, UInt32* pulCounterPbuffer, bool bBlock);
			internal static glXSendPbufferToVideoNV pglXSendPbufferToVideoNV = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXSwapBuffers(IntPtr dpy, Int32 drawable);
			internal static glXSwapBuffers pglXSwapBuffers = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXUseXFont(Int32 font, Int32 first, Int32 count, Int32 list_base);
			internal static glXUseXFont pglXUseXFont = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXVendorPrivate();
			internal static glXVendorPrivate pglXVendorPrivate = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXVendorPrivateWithReply();
			internal static glXVendorPrivateWithReply pglXVendorPrivateWithReply = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXWaitGL(Int32 context);
			internal static glXWaitGL pglXWaitGL = null;

			[System.Security.SuppressUnmanagedCodeSecurity()]
			internal delegate void glXWaitX();
			internal static glXWaitX pglXWaitX = null;

		}

		internal static partial class Imports
		{
			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXBindSwapBarrierNV", ExactSpelling = true)]
			internal extern static bool glXBindSwapBarrierNV(IntPtr dpy, UInt32 group, UInt32 barrier);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXBindVideoCaptureDeviceNV", ExactSpelling = true)]
			internal extern static int glXBindVideoCaptureDeviceNV(IntPtr dpy, UInt32 video_capture_slot, IntPtr device);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXBindVideoDeviceNV", ExactSpelling = true)]
			internal extern static unsafe int glXBindVideoDeviceNV(IntPtr dpy, UInt32 video_slot, UInt32 video_device, int* attrib_list);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXBindVideoImageNV", ExactSpelling = true)]
			internal extern static int glXBindVideoImageNV(IntPtr dpy, IntPtr VideoDevice, IntPtr pbuf, int iVideoBuffer);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXChangeDrawableAttributes", ExactSpelling = true)]
			internal extern static void glXChangeDrawableAttributes(Int32 drawable);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXChooseFBConfig", ExactSpelling = true)]
			internal extern static unsafe IntPtr * glXChooseFBConfig(IntPtr dpy, int screen, int* attrib_list, int* nelements);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXClientInfo", ExactSpelling = true)]
			internal extern static void glXClientInfo();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCopyContext", ExactSpelling = true)]
			internal extern static void glXCopyContext(Int32 source, Int32 dest, Int32 mask);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCopyImageSubDataNV", ExactSpelling = true)]
			internal extern static void glXCopyImageSubDataNV(IntPtr dpy, IntPtr srcCtx, UInt32 srcName, int srcTarget, int srcLevel, int srcX, int srcY, int srcZ, IntPtr dstCtx, UInt32 dstName, int dstTarget, int dstLevel, int dstX, int dstY, int dstZ, Int32 width, Int32 height, Int32 depth);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCreateContext", ExactSpelling = true)]
			internal extern static IntPtr glXCreateContext(IntPtr dpy, Glx.XVisualInfo vis, IntPtr shareList, bool direct);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCreateGLXPixmap", ExactSpelling = true)]
			internal extern static void glXCreateGLXPixmap(Int32 visual, Int32 pixmap, Int32 glxpixmap);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCreateNewContext", ExactSpelling = true)]
			internal extern static void glXCreateNewContext(Int32 config, Int32 render_type, Int32 share_list, Int32 direct);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCreatePbuffer", ExactSpelling = true)]
			internal extern static void glXCreatePbuffer(Int32 config, Int32 pbuffer);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCreatePixmap", ExactSpelling = true)]
			internal extern static void glXCreatePixmap(Int32 config, Int32 pixmap, Int32 glxpixmap);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXCreateWindow", ExactSpelling = true)]
			internal extern static void glXCreateWindow(Int32 config, Int32 window, Int32 glxwindow);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXDestroyContext", ExactSpelling = true)]
			internal extern static void glXDestroyContext(IntPtr dpy, Int32 context);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXDestroyGLXPixmap", ExactSpelling = true)]
			internal extern static void glXDestroyGLXPixmap(Int32 pixmap);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXDestroyPbuffer", ExactSpelling = true)]
			internal extern static void glXDestroyPbuffer(Int32 pbuffer);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXDestroyPixmap", ExactSpelling = true)]
			internal extern static void glXDestroyPixmap(Int32 glxpixmap);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXDestroyWindow", ExactSpelling = true)]
			internal extern static void glXDestroyWindow(Int32 glxwindow);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXEnumerateVideoCaptureDevicesNV", ExactSpelling = true)]
			internal extern static unsafe IntPtr glXEnumerateVideoCaptureDevicesNV(IntPtr dpy, int screen, int* nelements);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXEnumerateVideoDevicesNV", ExactSpelling = true)]
			internal extern static unsafe IntPtr glXEnumerateVideoDevicesNV(IntPtr dpy, int screen, int* nelements);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetCurrentDisplay", ExactSpelling = true)]
			internal extern static IntPtr glXGetCurrentDisplay();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetCurrentReadDrawable", ExactSpelling = true)]
			internal extern static IntPtr glXGetCurrentReadDrawable();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetDrawableAttributes", ExactSpelling = true)]
			internal extern static void glXGetDrawableAttributes(Int32 drawable);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetFBConfigAttrib", ExactSpelling = true)]
			internal extern static unsafe int glXGetFBConfigAttrib(IntPtr dpy, IntPtr config, int attribute, [Out]int value);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetFBConfigs", ExactSpelling = true)]
			internal extern static unsafe IntPtr * glXGetFBConfigs(IntPtr dpy, Int32 screen, [Out]Int32 nelements);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetProcAddress", ExactSpelling = true)]
			internal extern static unsafe IntPtr glXGetProcAddress(byte* procName);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetSelectedEvent", ExactSpelling = true)]
			internal extern static unsafe void glXGetSelectedEvent(IntPtr dpy, IntPtr draw, UInt32* event_mask);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetVideoDeviceNV", ExactSpelling = true)]
			internal extern static unsafe int glXGetVideoDeviceNV(IntPtr dpy, int screen, int numVideoDevices, [Out]IntPtr* pVideoDevice);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetVideoInfoNV", ExactSpelling = true)]
			internal extern static unsafe int glXGetVideoInfoNV(IntPtr dpy, int screen, IntPtr VideoDevice, UInt32* pulCounterOutputPbuffer, UInt32* pulCounterOutputVideo);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetVisualConfigs", ExactSpelling = true)]
			internal extern static void glXGetVisualConfigs();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXGetVisualFromFBConfig", ExactSpelling = true)]
			internal extern static IntPtr glXGetVisualFromFBConfig(IntPtr dpy, IntPtr config);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXIsDirect", ExactSpelling = true)]
			internal extern static void glXIsDirect(Int32 dpy, Int32 context);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXJoinSwapGroupNV", ExactSpelling = true)]
			internal extern static bool glXJoinSwapGroupNV(IntPtr dpy, IntPtr drawable, UInt32 group);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXLockVideoCaptureDeviceNV", ExactSpelling = true)]
			internal extern static void glXLockVideoCaptureDeviceNV(IntPtr dpy, IntPtr device);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXMakeContextCurrent", ExactSpelling = true)]
			internal extern static void glXMakeContextCurrent(Int32 drawable, Int32 readdrawable, Int32 context);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXMakeCurrent", ExactSpelling = true)]
			internal extern static bool glXMakeCurrent(IntPtr dpy, Int32 drawable, Int32 context);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryContext", ExactSpelling = true)]
			internal extern static void glXQueryContext();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryDrawable", ExactSpelling = true)]
			internal extern static unsafe void glXQueryDrawable(IntPtr dpy, IntPtr draw, int attribute, UInt32* value);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryExtensionsString", ExactSpelling = true)]
			internal extern static IntPtr glXQueryExtensionsString(IntPtr dpy, Int32 screen);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryFrameCountNV", ExactSpelling = true)]
			internal extern static unsafe bool glXQueryFrameCountNV(IntPtr dpy, int screen, UInt32* count);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryMaxSwapGroupsNV", ExactSpelling = true)]
			internal extern static unsafe bool glXQueryMaxSwapGroupsNV(IntPtr dpy, int screen, UInt32* maxGroups, UInt32* maxBarriers);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryServerString", ExactSpelling = true)]
			internal extern static IntPtr glXQueryServerString(IntPtr dpy, Int32 screen, Int32 name);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQuerySwapGroupNV", ExactSpelling = true)]
			internal extern static unsafe bool glXQuerySwapGroupNV(IntPtr dpy, IntPtr drawable, UInt32* group, UInt32* barrier);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryVersion", ExactSpelling = true)]
			internal extern static unsafe void glXQueryVersion(IntPtr dpy, [Out]Int32* major, [Out]Int32* minor);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXQueryVideoCaptureDeviceNV", ExactSpelling = true)]
			internal extern static unsafe int glXQueryVideoCaptureDeviceNV(IntPtr dpy, IntPtr device, int attribute, [Out]int* value);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXReleaseVideoCaptureDeviceNV", ExactSpelling = true)]
			internal extern static void glXReleaseVideoCaptureDeviceNV(IntPtr dpy, IntPtr device);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXReleaseVideoDeviceNV", ExactSpelling = true)]
			internal extern static int glXReleaseVideoDeviceNV(IntPtr dpy, int screen, IntPtr VideoDevice);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXReleaseVideoImageNV", ExactSpelling = true)]
			internal extern static int glXReleaseVideoImageNV(IntPtr dpy, IntPtr pbuf);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXRender", ExactSpelling = true)]
			internal extern static void glXRender();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXRenderLarge", ExactSpelling = true)]
			internal extern static void glXRenderLarge();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXResetFrameCountNV", ExactSpelling = true)]
			internal extern static bool glXResetFrameCountNV(IntPtr dpy, int screen);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXSelectEvent", ExactSpelling = true)]
			internal extern static void glXSelectEvent(IntPtr dpy, IntPtr draw, UInt32 event_mask);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXSendPbufferToVideoNV", ExactSpelling = true)]
			internal extern static unsafe int glXSendPbufferToVideoNV(IntPtr dpy, IntPtr pbuf, int iBufferType, UInt32* pulCounterPbuffer, bool bBlock);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXSwapBuffers", ExactSpelling = true)]
			internal extern static void glXSwapBuffers(IntPtr dpy, Int32 drawable);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXUseXFont", ExactSpelling = true)]
			internal extern static void glXUseXFont(Int32 font, Int32 first, Int32 count, Int32 list_base);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXVendorPrivate", ExactSpelling = true)]
			internal extern static void glXVendorPrivate();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXVendorPrivateWithReply", ExactSpelling = true)]
			internal extern static void glXVendorPrivateWithReply();

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXWaitGL", ExactSpelling = true)]
			internal extern static void glXWaitGL(Int32 context);

			[System.Security.SuppressUnmanagedCodeSecurity()]
			[System.Runtime.InteropServices.DllImport(Library, EntryPoint = "glXWaitX", ExactSpelling = true)]
			internal extern static void glXWaitX();

		}

	}
}
